# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : p13.py
# @Time     : 2024/5/9 23:03
# @Author   : Robot-Zsj
"""
description:

部门人力分配

https://fcqian.blog.csdn.net/article/details/134724995?spm=1001.2014.3001.5502

i:
3
3 5 3 4

o:
6

"""
m = int(input())
requirements = list(map(int, input().split()))


def check(limit):
    l = 0
    r = len(requirements) - 1

    need = 0

    while l <= r:
        if requirements[l] + requirements[r] <= limit:
            l += 1
        r -= 1
        need += 1
    return m >= need


def getResult():
    if len(requirements) == 1:
        return requirements[0]

    requirements.sort()

    low = requirements[-1]
    high = requirements[-2] + requirements[-1]

    ans = high

    while low <= high:
        mid = (low + high) >> 1

        if check(mid):
            ans = mid
            high = mid - 1
        else:
            low = mid + 1
    return ans

print(getResult())
